{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-10-14T02:42:42.022793Z",
     "start_time": "2019-10-14T02:42:40.338165Z"
    },
    "pycharm": {
     "is_executing": false
    }
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/opt/conda/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from tcn import compiled_tcn\n",
    "from utils import get_xy_kfolds\n",
    "from sklearn.metrics import mean_squared_error\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-10-14T02:42:42.451012Z",
     "start_time": "2019-10-14T02:42:42.025145Z"
    }
   },
   "outputs": [],
   "source": [
    "folds,enc = get_xy_kfolds()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-10-14T06:50:51.811354Z",
     "start_time": "2019-10-14T02:42:42.453309Z"
    },
    "pycharm": {
     "is_executing": true,
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x.shape= (?, 24)\n",
      "model.x = (?, 1000, 8)\n",
      "model.y = (?, 8)\n",
      "Epoch 1/100\n",
      "2794/2794 [==============================] - 20s 7ms/step - loss: 68.0583\n",
      "Epoch 2/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 41.9572\n",
      "Epoch 3/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 24.5881\n",
      "Epoch 4/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 13.4458\n",
      "Epoch 5/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 6.4616\n",
      "Epoch 6/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 2.4977\n",
      "Epoch 7/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 1.0665\n",
      "Epoch 8/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.8594\n",
      "Epoch 9/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.6765\n",
      "Epoch 10/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.5553\n",
      "Epoch 11/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.4711\n",
      "Epoch 12/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.4122\n",
      "Epoch 13/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.3630\n",
      "Epoch 14/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.3219\n",
      "Epoch 15/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.2862\n",
      "Epoch 16/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.2579\n",
      "Epoch 17/100\n",
      "2794/2794 [==============================] - 20s 7ms/step - loss: 0.2329\n",
      "Epoch 18/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.2135\n",
      "Epoch 19/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1962\n",
      "Epoch 20/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1802\n",
      "Epoch 21/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1671\n",
      "Epoch 22/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1553\n",
      "Epoch 23/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1446\n",
      "Epoch 24/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1347\n",
      "Epoch 25/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1255\n",
      "Epoch 26/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1182\n",
      "Epoch 27/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1112\n",
      "Epoch 28/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.1044\n",
      "Epoch 29/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0990\n",
      "Epoch 30/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0942\n",
      "Epoch 31/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0882\n",
      "Epoch 32/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0833\n",
      "Epoch 33/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0789\n",
      "Epoch 34/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0749\n",
      "Epoch 35/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0715\n",
      "Epoch 36/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0681\n",
      "Epoch 37/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0650\n",
      "Epoch 38/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0620\n",
      "Epoch 39/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0591\n",
      "Epoch 40/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0565\n",
      "Epoch 41/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0539\n",
      "Epoch 42/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0518\n",
      "Epoch 43/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0498\n",
      "Epoch 44/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0478\n",
      "Epoch 45/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0457\n",
      "Epoch 46/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0436\n",
      "Epoch 47/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0418\n",
      "Epoch 48/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0401\n",
      "Epoch 49/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0386\n",
      "Epoch 50/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0372\n",
      "Epoch 51/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0359\n",
      "Epoch 52/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0343\n",
      "Epoch 53/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0330\n",
      "Epoch 54/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0319\n",
      "Epoch 55/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0309\n",
      "Epoch 56/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0301\n",
      "Epoch 57/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0288\n",
      "Epoch 58/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0277\n",
      "Epoch 59/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0270\n",
      "Epoch 60/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0257\n",
      "Epoch 61/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0249\n",
      "Epoch 62/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0241\n",
      "Epoch 63/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0232\n",
      "Epoch 64/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0225\n",
      "Epoch 65/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0221\n",
      "Epoch 66/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0214\n",
      "Epoch 67/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0206\n",
      "Epoch 68/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0199\n",
      "Epoch 69/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0195\n",
      "Epoch 70/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0187\n",
      "Epoch 71/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0181\n",
      "Epoch 72/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0175\n",
      "Epoch 73/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0172\n",
      "Epoch 74/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0169\n",
      "Epoch 75/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0161\n",
      "Epoch 76/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0156\n",
      "Epoch 77/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0153\n",
      "Epoch 78/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0147\n",
      "Epoch 79/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0143\n",
      "Epoch 80/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0140\n",
      "Epoch 81/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0136\n",
      "Epoch 82/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0133\n",
      "Epoch 83/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0129\n",
      "Epoch 84/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0125\n",
      "Epoch 85/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0122\n",
      "Epoch 86/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0119\n",
      "Epoch 87/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0116\n",
      "Epoch 88/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0113\n",
      "Epoch 89/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0110\n",
      "Epoch 90/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0108\n",
      "Epoch 91/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0105\n",
      "Epoch 92/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0102\n",
      "Epoch 93/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0099\n",
      "Epoch 94/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0097\n",
      "Epoch 95/100\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0094\n",
      "Epoch 96/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0093\n",
      "Epoch 97/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0091\n",
      "Epoch 98/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0089\n",
      "Epoch 99/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0087\n",
      "Epoch 100/100\n",
      "2794/2794 [==============================] - 19s 7ms/step - loss: 0.0084\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f18fdfe9cc0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train_set_size:2794\n",
      "y_true:[0.75585  1.8273   0.79321  0.810668 0.120824 0.009247 0.7094   0.601214]\n",
      "y_pred:[0.8300596  1.9546034  0.7468406  0.8549483  0.14127728 0.00971216\n",
      " 0.79883957 0.568041  ]\n",
      "mse:0.004417816002578773\n",
      "x.shape= (?, 24)\n",
      "model.x = (?, 1000, 8)\n",
      "model.y = (?, 8)\n",
      "Epoch 1/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 264.8228\n",
      "Epoch 2/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 150.9494\n",
      "Epoch 3/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 77.5260\n",
      "Epoch 4/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 34.8306\n",
      "Epoch 5/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 12.4802\n",
      "Epoch 6/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 3.1224\n",
      "Epoch 7/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 1.8036\n",
      "Epoch 8/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 1.2830\n",
      "Epoch 9/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.9430\n",
      "Epoch 10/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.7132\n",
      "Epoch 11/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.5746\n",
      "Epoch 12/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.4884\n",
      "Epoch 13/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.4341\n",
      "Epoch 14/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.4016\n",
      "Epoch 15/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.3699\n",
      "Epoch 16/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.3382\n",
      "Epoch 17/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.3114\n",
      "Epoch 18/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.2857\n",
      "Epoch 19/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.2656\n",
      "Epoch 20/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.2465\n",
      "Epoch 21/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.2316\n",
      "Epoch 22/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.2194\n",
      "Epoch 23/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.2072\n",
      "Epoch 24/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1959\n",
      "Epoch 25/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.1858\n",
      "Epoch 26/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.1753\n",
      "Epoch 27/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1651\n",
      "Epoch 28/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1583\n",
      "Epoch 29/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1504\n",
      "Epoch 30/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.1422\n",
      "Epoch 31/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1365\n",
      "Epoch 32/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1297\n",
      "Epoch 33/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1266\n",
      "Epoch 34/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1195\n",
      "Epoch 35/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1142\n",
      "Epoch 36/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.1085\n",
      "Epoch 37/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.1030\n",
      "Epoch 38/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0981\n",
      "Epoch 39/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0933\n",
      "Epoch 40/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0887\n",
      "Epoch 41/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0842\n",
      "Epoch 42/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0811\n",
      "Epoch 43/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0768\n",
      "Epoch 44/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0729\n",
      "Epoch 45/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0697\n",
      "Epoch 46/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0663\n",
      "Epoch 47/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0630\n",
      "Epoch 48/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0606\n",
      "Epoch 49/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0576\n",
      "Epoch 50/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0551\n",
      "Epoch 51/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0535\n",
      "Epoch 52/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0509\n",
      "Epoch 53/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0494\n",
      "Epoch 54/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0478\n",
      "Epoch 55/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0450\n",
      "Epoch 56/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0431\n",
      "Epoch 57/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0407\n",
      "Epoch 58/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0394\n",
      "Epoch 59/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0377\n",
      "Epoch 60/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0355\n",
      "Epoch 61/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0343\n",
      "Epoch 62/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0331\n",
      "Epoch 63/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0325\n",
      "Epoch 64/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0303\n",
      "Epoch 65/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0297\n",
      "Epoch 66/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0278\n",
      "Epoch 67/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0269\n",
      "Epoch 68/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0254\n",
      "Epoch 69/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0245\n",
      "Epoch 70/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0237\n",
      "Epoch 71/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0226\n",
      "Epoch 72/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0219\n",
      "Epoch 73/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0210\n",
      "Epoch 74/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0206\n",
      "Epoch 75/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0197\n",
      "Epoch 76/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0191\n",
      "Epoch 77/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0181\n",
      "Epoch 78/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0173\n",
      "Epoch 79/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0169\n",
      "Epoch 80/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0165\n",
      "Epoch 81/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0157\n",
      "Epoch 82/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0152\n",
      "Epoch 83/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0150\n",
      "Epoch 84/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0139\n",
      "Epoch 85/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0138\n",
      "Epoch 86/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0129\n",
      "Epoch 87/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0127\n",
      "Epoch 88/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0122\n",
      "Epoch 89/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0122\n",
      "Epoch 90/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0118\n",
      "Epoch 91/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0113\n",
      "Epoch 92/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0112\n",
      "Epoch 93/100\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0105\n",
      "Epoch 94/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0104\n",
      "Epoch 95/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0100\n",
      "Epoch 96/100\n",
      "3552/3552 [==============================] - 25s 7ms/step - loss: 0.0096\n",
      "Epoch 97/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0095\n",
      "Epoch 98/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0092\n",
      "Epoch 99/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0090\n",
      "Epoch 100/100\n",
      "3552/3552 [==============================] - 24s 7ms/step - loss: 0.0085\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f18d3a12908>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train_set_size:3552\n",
      "y_true:[0.88545  2.0517   1.018537 0.895375 0.134689 0.009079 0.75525  0.690846]\n",
      "y_pred:[0.83563536 2.0971928  0.92631006 0.9065408  0.14294215 0.01020975\n",
      " 0.7965754  0.6845535 ]\n",
      "mse:0.0018747940419921757\n",
      "x.shape= (?, 24)\n",
      "model.x = (?, 1000, 8)\n",
      "model.y = (?, 8)\n",
      "Epoch 1/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 43.0135\n",
      "Epoch 2/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 12.3071\n",
      "Epoch 3/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 3.5359\n",
      "Epoch 4/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 2.2983\n",
      "Epoch 5/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 1.5991\n",
      "Epoch 6/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 1.1558\n",
      "Epoch 7/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.8747\n",
      "Epoch 8/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.7059\n",
      "Epoch 9/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.5858\n",
      "Epoch 10/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.4895\n",
      "Epoch 11/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.4085\n",
      "Epoch 12/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.3448\n",
      "Epoch 13/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.2970\n",
      "Epoch 14/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.2587\n",
      "Epoch 15/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.2278\n",
      "Epoch 16/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.2028\n",
      "Epoch 17/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1811\n",
      "Epoch 18/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1627\n",
      "Epoch 19/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1499\n",
      "Epoch 20/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1339\n",
      "Epoch 21/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1235\n",
      "Epoch 22/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1145\n",
      "Epoch 23/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.1038\n",
      "Epoch 24/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0956\n",
      "Epoch 25/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0874\n",
      "Epoch 26/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0799\n",
      "Epoch 27/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0730\n",
      "Epoch 28/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0672\n",
      "Epoch 29/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0619\n",
      "Epoch 30/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0569\n",
      "Epoch 31/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0529\n",
      "Epoch 32/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0495\n",
      "Epoch 33/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0461\n",
      "Epoch 34/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0430\n",
      "Epoch 35/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0399\n",
      "Epoch 36/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0374\n",
      "Epoch 37/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0350\n",
      "Epoch 38/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0327\n",
      "Epoch 39/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0306\n",
      "Epoch 40/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0290\n",
      "Epoch 41/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0270\n",
      "Epoch 42/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0253\n",
      "Epoch 43/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0243\n",
      "Epoch 44/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0229\n",
      "Epoch 45/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0217\n",
      "Epoch 46/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0207\n",
      "Epoch 47/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0193\n",
      "Epoch 48/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0183\n",
      "Epoch 49/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0175\n",
      "Epoch 50/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0166\n",
      "Epoch 51/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0156\n",
      "Epoch 52/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0149\n",
      "Epoch 53/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0141\n",
      "Epoch 54/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0135\n",
      "Epoch 55/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0130\n",
      "Epoch 56/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0124\n",
      "Epoch 57/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0119\n",
      "Epoch 58/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0115\n",
      "Epoch 59/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0110\n",
      "Epoch 60/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0104\n",
      "Epoch 61/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0101\n",
      "Epoch 62/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0096\n",
      "Epoch 63/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0092\n",
      "Epoch 64/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0090\n",
      "Epoch 65/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0089\n",
      "Epoch 66/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0088\n",
      "Epoch 67/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0083\n",
      "Epoch 68/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0079\n",
      "Epoch 69/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0075\n",
      "Epoch 70/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0073\n",
      "Epoch 71/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0071\n",
      "Epoch 72/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0070\n",
      "Epoch 73/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0069\n",
      "Epoch 74/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0065\n",
      "Epoch 75/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0064\n",
      "Epoch 76/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0062\n",
      "Epoch 77/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0060\n",
      "Epoch 78/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0059\n",
      "Epoch 79/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0058\n",
      "Epoch 80/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0057\n",
      "Epoch 81/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0056\n",
      "Epoch 82/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0054\n",
      "Epoch 83/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0054\n",
      "Epoch 84/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0052\n",
      "Epoch 85/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0052\n",
      "Epoch 86/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0050\n",
      "Epoch 87/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0050\n",
      "Epoch 88/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0049\n",
      "Epoch 89/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0048\n",
      "Epoch 90/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0049\n",
      "Epoch 91/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0048\n",
      "Epoch 92/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0047\n",
      "Epoch 93/100\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0047\n",
      "Epoch 94/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0047\n",
      "Epoch 95/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0046\n",
      "Epoch 96/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0044\n",
      "Epoch 97/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0045\n",
      "Epoch 98/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0045\n",
      "Epoch 99/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0043\n",
      "Epoch 100/100\n",
      "4311/4311 [==============================] - 30s 7ms/step - loss: 0.0043\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f18d37e2908>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train_set_size:4311\n",
      "y_true:[0.860363 1.474491 0.96965  0.87581  0.146342 0.010898 0.696379 0.71623 ]\n",
      "y_pred:[0.8938178  1.5261562  0.9444967  0.9710834  0.14255804 0.0103059\n",
      " 0.7613744  0.73095745]\n",
      "mse:0.0022442743423320343\n",
      "x.shape= (?, 24)\n",
      "model.x = (?, 1000, 8)\n",
      "model.y = (?, 8)\n",
      "Epoch 1/100\n",
      "5070/5070 [==============================] - 36s 7ms/step - loss: 45.8226\n",
      "Epoch 2/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 4.6997\n",
      "Epoch 3/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 2.3479\n",
      "Epoch 4/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 1.6677\n",
      "Epoch 5/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 1.2386\n",
      "Epoch 6/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.9361\n",
      "Epoch 7/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.7327\n",
      "Epoch 8/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.5901\n",
      "Epoch 9/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.4862\n",
      "Epoch 10/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.4145\n",
      "Epoch 11/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.3669\n",
      "Epoch 12/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.3260\n",
      "Epoch 13/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.2939\n",
      "Epoch 14/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.2691\n",
      "Epoch 15/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.2454\n",
      "Epoch 16/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.2224\n",
      "Epoch 17/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.2035\n",
      "Epoch 18/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1859\n",
      "Epoch 19/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1717\n",
      "Epoch 20/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1597\n",
      "Epoch 21/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1494\n",
      "Epoch 22/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1403\n",
      "Epoch 23/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1309\n",
      "Epoch 24/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1249\n",
      "Epoch 25/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1155\n",
      "Epoch 26/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1089\n",
      "Epoch 27/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.1026\n",
      "Epoch 28/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0973\n",
      "Epoch 29/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0913\n",
      "Epoch 30/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0869\n",
      "Epoch 31/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0823\n",
      "Epoch 32/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0800\n",
      "Epoch 33/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0743\n",
      "Epoch 34/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0704\n",
      "Epoch 35/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0667\n",
      "Epoch 36/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0647\n",
      "Epoch 37/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0611\n",
      "Epoch 38/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0579\n",
      "Epoch 39/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0553\n",
      "Epoch 40/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0538\n",
      "Epoch 41/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0535\n",
      "Epoch 42/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0498\n",
      "Epoch 43/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0478\n",
      "Epoch 44/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0455\n",
      "Epoch 45/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0433\n",
      "Epoch 46/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0424\n",
      "Epoch 47/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0406\n",
      "Epoch 48/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0384\n",
      "Epoch 49/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0382\n",
      "Epoch 50/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0368\n",
      "Epoch 51/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0347\n",
      "Epoch 52/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0341\n",
      "Epoch 53/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0331\n",
      "Epoch 54/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0313\n",
      "Epoch 55/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0304\n",
      "Epoch 56/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0307\n",
      "Epoch 57/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0287\n",
      "Epoch 58/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0277\n",
      "Epoch 59/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0268\n",
      "Epoch 60/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0260\n",
      "Epoch 61/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0250\n",
      "Epoch 62/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0243\n",
      "Epoch 63/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0235\n",
      "Epoch 64/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0226\n",
      "Epoch 65/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0229\n",
      "Epoch 66/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0219\n",
      "Epoch 67/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0215\n",
      "Epoch 68/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0213\n",
      "Epoch 69/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0198\n",
      "Epoch 70/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0192\n",
      "Epoch 71/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0188\n",
      "Epoch 72/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0182\n",
      "Epoch 73/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0183\n",
      "Epoch 74/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0174\n",
      "Epoch 75/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0183\n",
      "Epoch 76/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0172\n",
      "Epoch 77/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0162\n",
      "Epoch 78/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0159\n",
      "Epoch 79/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0151\n",
      "Epoch 80/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0149\n",
      "Epoch 81/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0144\n",
      "Epoch 82/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0142\n",
      "Epoch 83/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0137\n",
      "Epoch 84/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0137\n",
      "Epoch 85/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0132\n",
      "Epoch 86/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0136\n",
      "Epoch 87/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0125\n",
      "Epoch 88/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0125\n",
      "Epoch 89/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0121\n",
      "Epoch 90/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0118\n",
      "Epoch 91/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0117\n",
      "Epoch 92/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0118\n",
      "Epoch 93/100\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0114\n",
      "Epoch 94/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0109\n",
      "Epoch 95/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0108\n",
      "Epoch 96/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0105\n",
      "Epoch 97/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0104\n",
      "Epoch 98/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0102\n",
      "Epoch 99/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0101\n",
      "Epoch 100/100\n",
      "5070/5070 [==============================] - 35s 7ms/step - loss: 0.0093\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f16347aa1d0>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train_set_size:5070\n",
      "y_true:[1.026905 1.611733 1.014096 1.079214 0.159627 0.012674 0.813603 0.819672]\n",
      "y_pred:[1.0476167  1.586348   1.0373206  1.1811144  0.18007559 0.01273255\n",
      " 0.7849961  0.86136806]\n",
      "mse:0.0018714395955997517\n",
      "x.shape= (?, 24)\n",
      "model.x = (?, 1000, 8)\n",
      "model.y = (?, 8)\n",
      "Epoch 1/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 139.7857\n",
      "Epoch 2/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 35.0750\n",
      "Epoch 3/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 4.4459\n",
      "Epoch 4/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 1.5621\n",
      "Epoch 5/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 1.1352\n",
      "Epoch 6/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.8480\n",
      "Epoch 7/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.6581\n",
      "Epoch 8/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.5356\n",
      "Epoch 9/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.4467\n",
      "Epoch 10/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.3843\n",
      "Epoch 11/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.3407\n",
      "Epoch 12/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.3037\n",
      "Epoch 13/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.2729\n",
      "Epoch 14/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.2480\n",
      "Epoch 15/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.2266\n",
      "Epoch 16/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.2131\n",
      "Epoch 17/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1996\n",
      "Epoch 18/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.1867\n",
      "Epoch 19/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1748\n",
      "Epoch 20/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1636\n",
      "Epoch 21/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1545\n",
      "Epoch 22/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1452\n",
      "Epoch 23/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1379\n",
      "Epoch 24/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.1302\n",
      "Epoch 25/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1228\n",
      "Epoch 26/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1191\n",
      "Epoch 27/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1116\n",
      "Epoch 28/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1069\n",
      "Epoch 29/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.1012\n",
      "Epoch 30/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0965\n",
      "Epoch 31/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0911\n",
      "Epoch 32/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0865\n",
      "Epoch 33/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0818\n",
      "Epoch 34/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0777\n",
      "Epoch 35/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0751\n",
      "Epoch 36/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0711\n",
      "Epoch 37/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0678\n",
      "Epoch 38/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0642\n",
      "Epoch 39/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0616\n",
      "Epoch 40/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0584\n",
      "Epoch 41/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0554\n",
      "Epoch 42/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0532\n",
      "Epoch 43/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0499\n",
      "Epoch 44/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0482\n",
      "Epoch 45/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0455\n",
      "Epoch 46/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0427\n",
      "Epoch 47/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0404\n",
      "Epoch 48/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0386\n",
      "Epoch 49/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0368\n",
      "Epoch 50/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0347\n",
      "Epoch 51/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0331\n",
      "Epoch 52/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0313\n",
      "Epoch 53/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0298\n",
      "Epoch 54/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0285\n",
      "Epoch 55/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0269\n",
      "Epoch 56/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0256\n",
      "Epoch 57/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0246\n",
      "Epoch 58/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0233\n",
      "Epoch 59/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0221\n",
      "Epoch 60/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0211\n",
      "Epoch 61/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0213\n",
      "Epoch 62/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0207\n",
      "Epoch 63/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0190\n",
      "Epoch 64/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0183\n",
      "Epoch 65/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0174\n",
      "Epoch 66/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0166\n",
      "Epoch 67/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0160\n",
      "Epoch 68/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0151\n",
      "Epoch 69/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0145\n",
      "Epoch 70/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0142\n",
      "Epoch 71/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0140\n",
      "Epoch 72/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0129\n",
      "Epoch 73/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0123\n",
      "Epoch 74/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0119\n",
      "Epoch 75/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0119\n",
      "Epoch 76/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0113\n",
      "Epoch 77/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0110\n",
      "Epoch 78/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0107\n",
      "Epoch 79/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0102\n",
      "Epoch 80/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0099\n",
      "Epoch 81/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0095\n",
      "Epoch 82/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0090\n",
      "Epoch 83/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0086\n",
      "Epoch 84/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0086\n",
      "Epoch 85/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0083\n",
      "Epoch 86/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0084\n",
      "Epoch 87/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0081\n",
      "Epoch 88/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0078\n",
      "Epoch 89/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0075\n",
      "Epoch 90/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0072\n",
      "Epoch 91/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0072\n",
      "Epoch 92/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0072\n",
      "Epoch 93/100\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0071\n",
      "Epoch 94/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0066\n",
      "Epoch 95/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0064\n",
      "Epoch 96/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0064\n",
      "Epoch 97/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0061\n",
      "Epoch 98/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0062\n",
      "Epoch 99/100\n",
      "5829/5829 [==============================] - 41s 7ms/step - loss: 0.0059\n",
      "Epoch 100/100\n",
      "5829/5829 [==============================] - 40s 7ms/step - loss: 0.0057\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f15629ecc18>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train_set_size:5829\n",
      "y_true:[0.845201 1.563942 0.877281 1.028278 0.162615 0.008391 0.779757 0.763601]\n",
      "y_pred:[0.8108509  1.5758184  0.8468687  1.0259019  0.15817188 0.00943068\n",
      " 0.74160624 0.7605794 ]\n",
      "mse:0.0004671205911515846\n",
      "0.002175088914730864\n"
     ]
    }
   ],
   "source": [
    "mse_list = []\n",
    "for train_x,train_y,test_x,test_y in folds:\n",
    "    model = compiled_tcn(return_sequences=False,\n",
    "                         num_feat=test_x.shape[1],\n",
    "                         nb_filters=24,\n",
    "                         num_classes=0,\n",
    "                         kernel_size=8,\n",
    "                         dilations=[2 ** i for i in range(9)],\n",
    "                         nb_stacks=1,\n",
    "                         max_len=test_x.shape[0],\n",
    "                         use_skip_connections=True,\n",
    "                         regression=True,\n",
    "                         dropout_rate=0,\n",
    "                         output_len= test_y.shape[0])\n",
    "    model.fit(train_x,train_y,batch_size=256,epochs=100)\n",
    "    y_raw_pred = model.predict(np.array([test_x]))\n",
    "    y_pred = enc.inverse_transform(y_raw_pred).flatten()\n",
    "    y_true = enc.inverse_transform([test_y]).flatten()\n",
    "    mse_cur = mean_squared_error(y_true,y_pred)\n",
    "    mse_list.append(mse_cur)\n",
    "    print(f\"train_set_size:{train_x.shape[0]}\")\n",
    "    print(f\"y_true:{y_true}\")\n",
    "    print(f\"y_pred:{y_pred}\")\n",
    "    print(f\"mse:{mse_cur}\")\n",
    "print(np.mean(mse_list))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2019-10-14T06:50:51.821444Z",
     "start_time": "2019-10-14T06:50:51.815596Z"
    },
    "pycharm": {
     "is_executing": false,
     "name": "#%%\n"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total mse on test set: 0.002175088914730864\n"
     ]
    }
   ],
   "source": [
    "print(f\"total mse on test set: {np.mean(mse_list)}\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
